<?php
$file_name = 'User list-'.date('d-m-Y');
header("Content-type: application/octet-stream;charset=UTF-8");
header("Content-Disposition: csv; filename=\"{$file_name}.csv\"");
$dir_file = dirname(__FILE__);

$dir_file1 = explode(DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR, $dir_file);

define('ABSPATH_FB', $dir_file1[0] . '/');
define('CUR_PLUGIN_URL_FB', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..');

require_once( ABSPATH_FB . 'wp-load.php' );
$config = include CUR_PLUGIN_URL_FB . DIRECTORY_SEPARATOR . 'config.php';
$config['fileDir'] = CUR_PLUGIN_URL_FB;
$pluginClass = new stFacebookToolbox($config);

$pluginClass->excute();
$controllerName = $config['plugin_name'] . "Controller";
$controllerObject = new $controllerName($config);

$option = $controllerObject->option;
$config = $controllerObject->config;
$stPostcardUser_model = $controllerObject->loadmodel("stPostcardUser", CUR_PLUGIN_URL_FB . DIRECTORY_SEPARATOR);
$stPostcardUser_model->exportCSV();
?>
